Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add firstHopChannel/lastHopChannel parameters to findroute* API calls #1950

Closed
wants to merge 3 commits into from

Conversation

rorp
Copy link
Contributor

@rorp rorp commented Sep 14, 2021

The rationale behind this PR is repurposing https://github.com/C-Otto/rebalance-lnd for Eclair to allow the Eclair’s users to automatically re-balance their channels.

This PR allows the users to specify which channels exactly they want to re-balance by providing their short channel ID's using firstHopChannel and/or lastHopChannel parameters.

This is one PR in the upcoming series of PR's changing the router. Since the router is a one of the most critical parts, I’d like to keep them rather small.

@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2021

Codecov Report

Merging #1950 (690de0e) into master (03ac320) will increase coverage by 0.02%.
The diff coverage is 89.47%.

@@            Coverage Diff             @@
##           master    #1950      +/-   ##
==========================================
+ Coverage   87.63%   87.66%   +0.02%     
==========================================
  Files         159      159              
  Lines       12438    12448      +10     
  Branches      519      521       +2     
==========================================
+ Hits        10900    10912      +12     
+ Misses       1538     1536       -2     
Impacted Files Coverage Δ
...r-core/src/main/scala/fr/acinq/eclair/Eclair.scala 50.95% <0.00%> (ø)
...src/main/scala/fr/acinq/eclair/router/Router.scala 93.87% <ø> (ø)
.../src/main/scala/fr/acinq/eclair/router/Graph.scala 98.26% <100.00%> (+0.07%) ⬆️
...cala/fr/acinq/eclair/router/RouteCalculation.scala 99.27% <100.00%> (ø)
...clair/channel/publish/ReplaceableTxPublisher.scala 85.88% <0.00%> (-1.18%) ⬇️
...scala/fr/acinq/eclair/payment/PaymentRequest.scala 92.34% <0.00%> (+0.12%) ⬆️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 88.35% <0.00%> (+0.15%) ⬆️
...ala/fr/acinq/eclair/balance/ChannelsListener.scala 96.55% <0.00%> (+3.44%) ⬆️
...scala/fr/acinq/eclair/crypto/WeakEntropyPool.scala 94.73% <0.00%> (+5.26%) ⬆️

@t-bast
Copy link
Member

t-bast commented Sep 14, 2021

Completely unrelated to this PR, but while we have you, can you please fix this regression: #1947

Comment on lines +198 to +199
firstHopChannelId: Option[ShortChannelId],
lastHopChannelId: Option[ShortChannelId]): Seq[GraphEdge] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't touch dijkstraShortestPath, there is no need. Instead search for a path from the end of firstHopChannelId to the start of lastHopChannelId and add our nodeId to ignoredVertices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out there's no need in changing Router at all. All above can be done over the API parameters (see #1969). I'm closing this PR.

eclair-core/src/main/scala/fr/acinq/eclair/Eclair.scala Outdated Show resolved Hide resolved
@@ -122,9 +122,9 @@ trait Eclair {

def sendOnChain(address: String, amount: Satoshi, confirmationTarget: Long): Future[ByteVector32]

def findRoute(targetNodeId: PublicKey, amount: MilliSatoshi, pathFindingExperimentName_opt: Option[String], assistedRoutes: Seq[Seq[PaymentRequest.ExtraHop]] = Seq.empty)(implicit timeout: Timeout): Future[RouteResponse]
def findRoute(targetNodeId: PublicKey, amount: MilliSatoshi, pathFindingExperimentName_opt: Option[String], assistedRoutes: Seq[Seq[PaymentRequest.ExtraHop]] = Seq.empty, firstHopChannelId_opt: Option[ShortChannelId], lastHopChannelId_opt: Option[ShortChannelId])(implicit timeout: Timeout): Future[RouteResponse]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need to change both findRoute and findRouteBetween?
It seems to me that findRouteBetween is sufficient and is the API that better matches rebalancing needs, isn't it?

@t-bast
Copy link
Member

t-bast commented Sep 20, 2021

We just merged a change to continually edit release notes as PRs are accepted (#1951).
Could you rebase and add a section in the release notes to document the API change?

@rorp rorp closed this Sep 26, 2021
@rorp rorp deleted the fist_and_last_hops branch September 26, 2021 22:44
@viaj3ro
Copy link

viaj3ro commented Oct 27, 2021

The rationale behind this PR is repurposing https://github.com/C-Otto/rebalance-lnd for Eclair to allow the Eclair’s users to automatically re-balance their channels.

does this work now, with the new APIs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants